﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace Module_Basic_Entities
{    
    public struct Tile
    {
        public int Id { get; set; }
        public bool Walkable { get; set; }
        public bool Triggable { get; set; }
        public int Width { get; set; }
        public int Height { get; set; }
        public Vector2 Position { get; set; }
        public int TriggerType { get; set; }
        
        private Rectangle DestRect
        {
            get
            {
                rect.X = (int)this.Position.X;
                rect.Y = (int)this.Position.Y;
                rect.Width = this.Width;
                rect.Height = this.Height;

                return rect;
            }
        }
        private static Rectangle rect;

        public static bool Intersects(Rectangle objDestRect, Tile a)
        {
            if (objDestRect.Intersects(a.DestRect))
            {
                return true;
            }
            
            return false;
        }

        public static bool Contains(Vector2 point, Tile a)
        {
            return a.DestRect.Contains((int)point.X, (int)point.Y);
        }

    }
}
